@echo off
REM Simple Chrome Debug Mode Launcher
REM Closes all Chrome instances and starts Chrome in debug mode

REM Close all Chrome instances
echo Closing all Chrome instances...
taskkill /F /IM chrome.exe >nul 2>&1

REM Wait 2 seconds
ping 127.0.0.1 -n 2 >nul

REM Define Chrome path
set chrome_path="C:\Program Files\Google\Chrome\Application\chrome.exe"

REM Check if Chrome exists
if exist %chrome_path% (
    echo Chrome found at %chrome_path%
) else (
    echo Chrome not found at %chrome_path%
    echo Please update the chrome_path in this script
    pause
    exit /b 1
)

REM Start Chrome in debug mode with Mi Note page
echo Starting Chrome in debug mode...
echo Debug port: 9222
%chrome_path% --remote-debugging-port=9222 https://i.mi.com/note

REM Instructions
echo.
echo Chrome debug mode started successfully!
echo.
echo Please do the following in the opened browser:
echo 1. Login to your Xiaomi Cloud account
echo 2. Make sure you can see your notes list
echo 3. Then run the export tool

echo.
pause